{% extends 'baykeshop/base_site.html' %}

{% load i18n bayke_tags %}

{% block title %}全部商品{% endblock %}

{% block container %}
    <div class="container mt-3">
        <!-- 筛选模块 -->
        {% strtoint query.categorys as categorys %}
        <div class="box is-radiusless is-shadowless is-marginless">
        {% for cate in cates %}
            <a class="{% if categorys == cate.id %} has-text-danger {% else %} has-text-black-bis  {% endif %} mr-2" href="{% url 'baykeshop:goods-list' %}?categorys={{ cate.id }}">{{ cate.name }}</a>               
        {% endfor %}
        </div>

        <div class="box is-radiusless">
            <span class="has-text-grey">分类：</span>
            <a class="{% if request.get_full_path == '/goods/' %}has-text-danger {% else %} has-text-black-bis {% endif %} mr-2" href="{% url 'baykeshop:goods-list' %}">全部分类</a>
            {% for sub_cate in sub_cates %}
                 <a class="{% if categorys == sub_cate.id %} has-text-danger {% else %} has-text-black-bis {% endif %} mr-2" 
                    href="{% url 'baykeshop:goods-list' %}?categorys={{ sub_cate.id }}">{{ sub_cate.name }}</a>
            {% endfor %} 
            <div class="mt-1">
                <span class="has-text-grey">排序：</span>
                {% ordering_tag request 'baykeproduct__price' '价位' %}
                {% ordering_tag request 'baykeproduct__sales' '销量'  %}
                {% ordering_tag request 'add_date' '时间' %}
            </div>
        </div>

        <!-- 筛选模块 end -->
        <div class="columns is-multiline">
            {% for spu in goods.results %}
            <div class="column is-3">
                <div class=" has-background-white">
                    {% spu_box spu %}
                </div>
            </div>
            {% endfor %}
        </div>

        {% pages request goods %}
    </div>
    
    
{% endblock %}
    
    